# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

_pkgname=V3n0M-Scanner
pkgname=v3n0m
pkgver=536.16b629f
pkgrel=5
groups=('blackarch' 'blackarch-scanner' 'blackarch-webapp' 'blackarch-recon')
pkgdesc='Offensive Security Tool for Vulnerability Scanning & Pentesting'
arch=('any')
url='https://github.com/v3n0m-Scanner/V3n0M-Scanner'
license=('GPL3')
depends=('python' 'python-termcolor' 'python-aiohttp' 'python-asyncio'
         'python-beautifulsoup4' 'python-dnspython' 'python-tqdm'
         'python-requests' 'python-httplib2' 'python-tld' 'python-fuzzywuzzy'
         'python-python-socks' 'python-pysocks' 'python-pyparsing')
makedepends=('git')
source=("git+https://github.com/$_pkgname/$_pkgname.git")
sha1sums=('SKIP')

pkgver() {
  cd $_pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $_pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  install -Dm 644 "src/desktop-menu/$pkgname.ico" \
    "$pkgdir/usr/share/icons/$pkgname.ico"
  install -Dm644 "src/desktop-menu/$pkgname.desktop" \
    "$pkgdir/usr/share/applications/$pkgname.desktop"

  rm -rf doc/ *.md LICENSE .git* .*.yaml *.GPL PKGBUILD *.sh *.png docker \
    src/desktop-menu poetry.lock pyproject.toml

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname/src
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

